package factory;

import factory.hero.Camille;
import factory.hero.Diana;
import factory.hero.Irelia;

/**
 * @Author Doris.Lee
 * @Description 简单工厂模式：用于生产对象
 * @Locate factory.HeroFactory
 * @Datetime 2020-05-25 10:50
 * @Version 1.0
 */
public class HeroFactory {
    public static ISkill getHero(String name) throws Exception {
        ISkill iSkill;
        //interface:统一方法调用，不能统一对象实例化
        switch (name){
            case "Diana":
                iSkill = new Diana();
                break;
            case "Irelia":
                iSkill = new Irelia();
                break;
            case "Camille":
                iSkill = new Camille();
                break;
            default:
                throw new Exception();
        }
        return iSkill;
    }
}
